<template>
  <div class="siteaside-container">
    <!--头像区域 -->
    <div>
      <div class="avatar-box">
        <Avatar :url="user?.avatar" />
      </div>
      <!-- 微博名称 -->
      <div class="weibo-name" v-if="user?.blogName">
        <span>{{ user?.blogName }}</span>
      </div>
    </div>

    <!-- 导航区域 -->
    <div class="menu-box">
      <Menu />
    </div>
    <!-- 信息区域 -->
    <div class="contact-box">
      <Contact :userInfo="user" />
    </div>

    <!-- 退出微博 -->
    <!-- <div class="logout-box" @click="handlerLayout">
      <img :src="loginOutSVGUrl" alt="退出" />
    </div> -->
  </div>
</template>

<script>
import Avatar from "@/components/Avatar";
import Menu from "./Menu";
import Contact from "./Contact";
import { mapState } from "vuex";
import loginOutSVG from "@/assets/loginOut.svg";
export default {
  name: "SiteAsude",
  components: {
    Avatar,
    Menu,
    Contact,
  },
  computed: {
    ...mapState("loginUser", ["user"]),
    // 将导入的 svg URL 暴露给模板使用
    loginOutSVGUrl() {
      return loginOutSVG;
    },
  },
  methods: {
    async handlerLayout() {
      this.$emit("logout");
    },
  },
};
</script>

<style scoped lang="less">
.siteaside-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 30px;

  .avatar-box {
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .weibo-name {
    display: flex;
    justify-content: center;
    align-items: center;

    span {
      color: #fff;
      font-weight: 700;
      text-shadow: 8px 8px 18px rgba(255, 255, 255, 0.9);
    }
  }

  .logout-box {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
